package com.asiainfo.iam.mapper;


import com.asiainfo.iam.entity.po.ModoTeamMember;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ModoTeamMemberMapper {


    @Insert("insert into modo_team_member(member_id, " +
            "create_dt, " +
            "create_user, " +
            "lastupd, " +
            "member_name, " +
            "role_name, " +
            "state, " +
            "team_name, " +
            "update_user, " +
            "user_id, " +
            "version)" +
            "values(#{memberId}, #{createDt}, #{createUser}, " +
            "#{lastupd}, #{memberName}, #{roleName}, " +
            "#{state}, #{teamName}, #{updateUser}, #{userId}, #{version})")
    int insert(ModoTeamMember modoTeamMember);
    @Select("select * from modo_team_member where user_id= #{userId}")
    ModoTeamMember findById(String userId);

    @Select("select * from modo_team_member where team_name = #{teamName}")
    List<ModoTeamMember> findAllUser(String teamName);

    @Delete("delete from modo_team_member where user_id = #{userId}")
    void deleteById(String userId);

    @Update("UPDATE modo_team_member " +
            "SET create_dt = #{createDt}, " +
            "    create_user = #{createUser}, " +
            "    lastupd = #{lastupd}, " +
            "    member_name = #{memberName}, " +
            "    role_name = #{roleName}, " +
            "    state = #{state}, " +
            "    team_name = #{teamName}, " +
            "    update_user = #{updateUser}, " +
            "    version = #{version} " +
            "WHERE user_id = #{userId}")
    void update(ModoTeamMember modoTeamMember);
}

